// pages/index/myHome/myHome.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    colors: [
      '#4D8AD7',
      '#006400',
      '#00688B',
      '#00B2EE',
      '#00CD00',
      '#00CD66',
      '#00FA9A',
      '#00FF7F',
      '#5E5E5E',
      '#68228B',
      '#8B4726',
      '#8B8B00',
      "#FF7F24",
      "#FF3E96",
      "#FF0000",
      "#EEEE00",
      "#D15FEE",
      "#8B1A1A",
      "#CDC8B1",
      "#CD8C95",
      "#BDB76B",
      "#FFFFAA",
      "#DEFFAC",
      "#B0C4DE",
      "#9AFF9A",
      "#404040",
      "#00EE00",
      "#080808",
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: '选择皮肤',
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  choose: function (e) {
    wx.setStorageSync('backgroundColor', e.currentTarget.dataset.color);
    wx.showModal({
      title: '提示',
      content: '皮肤更改成功，重启应用后生效！',
      showCancel: false,
      success: function (res) {
        if (res.confirm)
          wx.navigateBack({
            delta: 1
          })
      }
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  }
})